const express = require("express");
const expressJoi = require("../utils/express-joi");
const {
  reg_menu_list_schema,
  reg_menu_add_schema,
  reg_menu_edit_schema,
  reg_menu_delete_schema,
} = require("../schemas/menuSchema");

const menuController = require("../controllers/menuController");

const router = express.Router();

router.post("/add", expressJoi(reg_menu_add_schema), menuController.addMenu);

router.post("/edit", expressJoi(reg_menu_edit_schema), menuController.editMenu);

router.delete(
  "/delete/:id",
  expressJoi(reg_menu_delete_schema),
  menuController.deleteMenu
);

router.get("/treeList", menuController.getMenuTreeList);

module.exports = router;
